<!DOCTYPE html>
<html>
<head>
    <title>海康摄像播放示例</title>
    <script src="https://open.ys7.com/sdk/js/ezuikit.js"></script>
    <script>
        function initPlayer() {
            var videoContainer = document.getElementById('video-container');
            var player = EZUIKit.getInstance('player');
            player.initPlayer(videoContainer, '1');
            player.setStreamType('RTSP');
            player.setSrc('rtsp://192.168.2.1:554/cam/realmonitor?channel=1&subtype=0');
            player.setAutoPlay(true);
            player.setRenderMode('HTML5');
            player.setCatchError(() => {
                console.error('播放器错误');
            });
            player.setOnPlay(() => {
                console.log('播放中');
            });
            player.setOnPause(() => {
                console.log('暂停');
            });
            player.setOnStop(() => {
                console.log('停止');
            });
            player.setOnError((errorType, errorCode) => {
                console.error('错误类型:', errorType, '错误代码:', errorCode);
            });
        }
    </script>
</head>
<body onload="initPlayer()">
    <div id="video-container" style="width: 640px; height: 480px;"></div>
</body>
</html>